package routers

import (
	"NovelBook/controller/manager"
	"NovelBook/utils/auth"
	"github.com/gin-gonic/gin"
)

func SetManagerRouter(r *gin.Engine) {

	// 注册
	r.POST(baseUrl+managerUrl+"/register", manager.Register)

	r.POST(baseUrl+managerUrl+"/login-account", manager.LoginByAccount)

	r.POST(baseUrl+managerUrl+"/login-email", manager.LoginByEmail)

	r.POST(baseUrl+managerUrl+"/reset-password", manager.ResetPassword)

	mgr := r.Group(baseUrl + managerUrl)
	mgr.Use(auth.JWTAuthSuperUser(), auth.JWTAuthManager())
	{
		//以下api规则可按照需求进行修改

		// 修改昵称或者头像
		mgr.PUT("/user", manager.Modify)

		// 管理员工

		// 为 worker 注册账号
		mgr.POST("/worker/register", manager.WorkerRegister)

		// 通过ID修改员工信息
		//mgr.PUT("/worker/mod-id", manager.PutWorker)

		// 获取所有员工信息
		mgr.GET("/worker/info-all", manager.GetAllWorkers)

		// 获取在职员工
		mgr.GET("/worker/on-job", manager.GetWorkersOn)

		// 获取离职员工
		mgr.GET("/worker/exit-job", manager.GetWorkersOff)

		// 通过ID获取员工信息
		mgr.GET("/worker/info-id", manager.GetWorkerByID)

		// 通过ID 删除离职员工
		mgr.POST("/worker/del-id", manager.DelWorkerByID)

		// 通过ID 离职员工
		mgr.POST("/worker/off-id", manager.SetWorkerOff)

		// 通过ID 复职员工
		mgr.POST("/worker/on-id", manager.SetWorkerOn)

		// any other API you need
	}

	// any other manager API you need
}
